package com.uchiha.nova.mainService.controller;

import com.uchiha.nova.core.properties.RabbitOrderProperties;
import com.uchiha.nova.core.tool.api.R;
import com.uchiha.nova.core.tool.support.BaseController;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author 周林静
 * @Date 2025/4/7 23:16
 * @Version 1.0
 */
@RestController
@RequestMapping("/rabbit")
@Slf4j
@Tag(name = "rabbitmq")
public class RabbitController extends BaseController {

    @Resource
    RabbitTemplate rabbitTemplate;

    @Resource
    RabbitOrderProperties orderProperties;

    @GetMapping("/test")
    public R test(){
        rabbitTemplate.convertAndSend(orderProperties.getExchange(),orderProperties.getRouter_key(),"uchihashiamu");
        return R.success("发送成功");
    }
}
